/*
*   Handles the request type, and the id of the object
*   the request is for.
*
*/

#include <stdlib.h>

#include "Request.h"

RequestPtr requestConstructor(int requestType, int objectID) {
    RequestPtr toReturn = (RequestPtr) malloc(sizeof(RequestStr));
    toReturn->requestType = requestType;
    toReturn->objectID = objectID;
    toReturn->destruct = requestDestructor;
    return toReturn;
}

/*
*   Use only for condition variables, since the mutex they are associated with cannot be predicted.
*/
RequestPtr requestCVConstructor(int requestType, int objectID, int mutexID) {
    RequestPtr toReturn = requestConstructor(requestType, objectID);
    toReturn->mutexID = mutexID;
    return toReturn;
}

void requestDestructor(RequestPtr this) {
    free(this);
}
